package com.lagou.模块四;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;

//编写程序，循环接收用户从键盘输入多个字符串，直到输入“end”时循环结束，并将所有已输入的字符串按字典顺序倒序录入到项目下abc.txt中
public class Receive {
    public static void main(String[] args) throws IOException{
        StringBuffer sbf = new StringBuffer();
        FileWriter fw = new FileWriter("D:/abc.txt");
        BufferedReader br = null;
        while (true) {
            br = new BufferedReader(new InputStreamReader(System.in));

            String str = br.readLine();
            if (str.equals("end")){
                break;
            }else{
                sbf.append(str);
            }
        }
        String s = new String(sbf.reverse());
        System.out.println(s);
        fw.write(s);
        fw.flush();
        fw.close();


    }
}
